/*
 * @Author: your name
 * @Date: 2022-02-28 09:58:15
 * @LastEditTime: 2022-02-28 10:08:56
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \JS\day02\5-数组序列化方法.js
 */
var  arr=[1,2,3,4,{a:1}];
console.log(arr,'原素组');
//数组序列化 将数组转换为字符串并且以逗号隔开每一项
var result=arr.toString() //1,2,3,4,[object Object]
console.log(result,typeof result);

//join将数组转化为字符串
var result1=arr.join('');//1234[object Object] string  
var result1=arr.join(',');//1,2,3,4,[object Object] string

console.log(result1,typeof result1);

var obj={
    name:'hello'
}
console.log(obj.toString(),typeof(obj.toString()),'对象类型调用tostring')